package com.leon.datalink.core.persistence.event;

import java.util.Map;

/**
 * 节点配置事件
 * 当节点配置发生变化时触发
 * 
 * @author leon
 */
public class NodeConfiguredEvent implements NodeEvent {
    
    private String nodeId;
    private Map<String, Object> properties;
    private long timestamp;
    
    public NodeConfiguredEvent() {
        // 默认构造函数，用于序列化
    }
    
    public NodeConfiguredEvent(String nodeId, Map<String, Object> properties) {
        this.nodeId = nodeId;
        this.properties = properties;
        this.timestamp = System.currentTimeMillis();
    }
    
    @Override
    public String getNodeId() {
        return nodeId;
    }
    
    @Override
    public long getTimestamp() {
        return timestamp;
    }
    
    @Override
    public String getEventType() {
        return "NODE_CONFIGURED";
    }
    
    public Map<String, Object> getProperties() {
        return properties;
    }
    
    public void setNodeId(String nodeId) {
        this.nodeId = nodeId;
    }
    
    public void setProperties(Map<String, Object> properties) {
        this.properties = properties;
    }
    
    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }
    
    @Override
    public String toString() {
        return "NodeConfiguredEvent{" +
                "nodeId='" + nodeId + '\'' +
                ", properties=" + properties +
                ", timestamp=" + timestamp +
                '}';
    }
}
